AssignDataFromGridReal Subroutine

private subroutine AssignDataFromGridReal(grid, network, scaleFactor)

assign data to a network from grid_real

Arguments

Type IntentOptional Attributes Name
type(grid_real), intent(in) :: grid
type(ObservationalNetwork), intent(inout) :: network
real(kind=float), intent(in), optional :: scaleFactor

Variables

Type Visibility Attributes Name Initial
logical, public :: check
integer(kind=short), public :: i
integer(kind=short), public :: j
integer(kind=short), public :: k
real(kind=float), public :: x
real(kind=float), public :: y

Source Code

SUBROUTINE AssignDataFromGridReal &
!
( grid, network, scaleFactor  )

IMPLICIT NONE

!Arguments with intent(in)
TYPE (grid_real), INTENT (IN) :: grid
REAL (KIND = float), OPTIONAL, INTENT (IN) :: scaleFactor 

!Argument with intent (inout):
TYPE (ObservationalNetwork), INTENT (INOUT) :: network

!local declarations
INTEGER (KIND = short) :: i, j, k
REAL (KIND = float) :: x, y
LOGICAL             :: check
!------------------------------------end of declarations-----------------------

DO k = 1, network % countObs
    
    x = network % obs (k) % xyz % easting
    y = network % obs (k) % xyz % northing
    
    CALL GetIJ (x, y, grid, i, j, check)
    
    IF ( check .AND. grid % mat (i,j) /= grid % nodata ) THEN
        network % obs (k) % value = grid % mat (i,j)
    ELSE
        network % obs (k) % value =  network % nodata
    END IF
   
END DO

!apply scale factor
IF ( PRESENT ( scaleFactor ) ) THEN
    DO k = 1, network % countObs
      IF ( network % obs (k) % value /=  network % nodata ) THEN
           network % obs (k) % value = network % obs (k) % value * scaleFactor
      END IF
    END DO
END IF



RETURN
END SUBROUTINE AssignDataFromGridReal